(newbie) type signature "Maybe a" doesn't like "Just [Event]"
Posted
by sisif
on Stack Overflow
See other posts from Stack Overflow
or by sisif
Published on 2010-05-24T08:56:12Z
Indexed on
2010/05/24
9:01 UTC
Read the original article
Hit count: 166
i'm still learning Haskell and need help with the type inference please!
using packages SDL and Yampa i get the following type signature from FRP.Yampa.reactimate:
(Bool -> IO (DTime, Maybe a))
and i want to use it for:
myInput :: Bool -> IO (DTime, Maybe [SDL.Event])
myInput isBlocking = do
event <- SDL.pollEvent
return (1, Just [event])
...
reactimate myInit myInput myOutput mySF
but it says
Couldn't match expected type `()'
against inferred type `[SDL.Event]'
Expected type: IO (DTime, Maybe ())
Inferred type: IO (DTime, Maybe [SDL.Event])
In the second argument of `reactimate', namely `input'
In the expression: reactimate initialize input output process
i thought "Maybe a" allows me to use anything, even a SDL.Event list? why is it expecting "Maybe ()" when the type signature is actually "Maybe a"? why does it want an empty tuple, or a function taking no arguments, or what is () supposed to be?
© Stack Overflow or respective owner